//
//  ZCBaseWMPageViewController.m
//  gamebox_qpp
//
//  Created by 赵隆杰 on 2022/9/19.
//

#import "ZCBaseWMPageViewController.h"

@interface ZCBaseWMPageViewController ()

@end

@implementation ZCBaseWMPageViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.view.backgroundColor = kBgColor;
    
    [self setupNavi];
    
    self.menuView.backgroundColor = [UIColor whiteColor];
}

- (void)setupNavi {
    UIView *naviView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SL_WINDOW_WIDTH, UIDevice.vg_navigationFullHeight)];
    naviView.backgroundColor = [[UIColor whiteColor] colorWithAlphaComponent:1.0];
    [self.view addSubview:naviView];
    self.naviView = naviView;
    
    UIButton *backBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, UIDevice.vg_statusBarHeight, UIDevice.vg_navigationBarHeight, UIDevice.vg_navigationBarHeight)];
    backBtn.contentMode = UIViewContentModeCenter;
    [backBtn setImage:[UIImage imageNamed:@"ic_detail_toolbar_back_black"] forState:UIControlStateNormal];
    [backBtn addTarget:self action:@selector(backBtnClick) forControlEvents:UIControlEventTouchUpInside];
    [self.naviView addSubview:backBtn];
    self.backBtn = backBtn;
    
    UIButton *rightBtn = [[UIButton alloc] initWithFrame:CGRectMake(SL_WINDOW_WIDTH - UIDevice.vg_navigationBarHeight, UIDevice.vg_statusBarHeight, UIDevice.vg_navigationBarHeight, UIDevice.vg_navigationBarHeight)];
    rightBtn.contentMode = UIViewContentModeCenter;
    [rightBtn setTitleColor:kColor333333 forState:UIControlStateNormal];
    [rightBtn addTarget:self action:@selector(rightBtnClick) forControlEvents:UIControlEventTouchUpInside];
    [self.naviView addSubview:rightBtn];
    self.rightBtn = rightBtn;
    
    UILabel *centerTitle = [[UILabel alloc] initWithFrame:CGRectMake(backBtn.right, UIDevice.vg_statusBarHeight, rightBtn.left - backBtn.right, UIDevice.vg_navigationBarHeight)];
    centerTitle.center = CGPointMake(self.naviView.centerX, rightBtn.centerY);
    centerTitle.font = [UIFont boldSystemFontOfSize:18];
    centerTitle.textColor = kColor333333;
    centerTitle.textAlignment = NSTextAlignmentCenter;
    [self.naviView addSubview:centerTitle];
    self.centerTitle = centerTitle;
    
    UILabel *bottomLine = [[UILabel alloc] initWithFrame:CGRectMake(0, naviView.bottom - 1, naviView.width, 1)];
    bottomLine.backgroundColor = kLineColor;
    [self.naviView addSubview:bottomLine];
    
    ZCBaseWMPageViewController *first = (ZCBaseWMPageViewController *)self.navigationController.viewControllers.firstObject;
    if ([first isEqual:self]) {
        self.backBtn.hidden = YES;
        self.rightBtn.hidden = YES;
    } else {
        self.backBtn.hidden = NO;
        self.rightBtn.hidden = NO;
    }
}


- (void)backBtnClick
{
    [self.navigationController popViewControllerAnimated:YES];
}

- (void)rightBtnClick
{
    
}

@end
